﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.Core.Objects;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace System.Data
{
    public interface IDbContext:IDisposable 
    {
        string ConnectionString { get; }
        ObjectContext ObjectContext { get; }
        Database Database { get; }
        IDbSet<TEntity> Set<TEntity>() where TEntity : EntityBase;

        /// <summary>
        /// 
        /// </summary>
        /// <returns>已写入基础数据库的对象的数目</returns>
        int SaveChanges();

        Task<int> SaveChangesAsync(CancellationToken cancellationToken);
        Task<int> SaveChangesAsync();
    }
}
